#include<stdio.h>
#include<unistd.h>
#include<sys/wait.h>


int main(int argc, char *argv[])

{
      pid_t pid;
      pid = fork();

      if (pid == 0){
		printf("I am child, my parent id = %d, going to sleep 10s \n", getppid());
		sleep(10);
		printf("--------------child gong to die----------------");
	
	}else if (pid > 0) {
	        while (1){
	        	printf("I am parent, pid = %d, myson = %d\n", getpid(), pid);
	        	sleep(1);
	        }
	}else {
		perror("fork error");
		return 1;
	}
      return 0;
}
